<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link type="text/css" rel="stylesheet" href="__PUBLIC__/weui-1.0.2/dist/style/weui.min.css"/>
    <link type="text/css" rel="stylesheet" href="__PUBLIC__/dpa/css/jquery-weui.css"/>
    <link type="text/css" rel="stylesheet" href="__PUBLIC__/dpa/css/weui.css"/>
    <link type="text/css" rel="stylesheet" href="__PUBLIC__/dpa/css/search.css"/>
    <link rel="stylesheet" href="__PUBLIC__/dpa/css/page.css" />
    <script type="text/javascript" src="__PUBLIC__/dpa/js/jquery-2.1.4.js"></script>
    <script type="text/javascript" src="__PUBLIC__/dpa/js/jquery-weui.js"></script>
    <title>已取报告</title>
    <style>
        body{
            background: #ffffff;
        }
        table{
            width: 99.8%;
            margin: 0 auto;
            border-collapse: collapse;
            font-size: 14px;
            font-weight: 400;
            border:#ffffff;
            text-align: center;
        }
        td{
            font-size: 14px;
            border-bottom: 1px #eee dotted;
            border-right: 1px #eee solid;
        }
        td:nth-last-child(1){
            border-right:none;
        }
        th:nth-last-child(1){
            border-right:none;
        }
        th{
            background:#336666;
            color: #ffffff;
            padding: 2% 0.4%;
            border-right: 1px #ffffff solid;
        }
        th:nth-child(1){
            width: 12%;
        }
    </style>
</head>

<body>
<!------------------------时间搜索开始---------------------------->
<form action="__ACTION__" method="get">
    <input type="hidden" name="openid" value="{$openid}">
    <div class="box" >
        <div class="weui_cells weui_cells_form" style="margin-top:5px">
            <div class="weui_cell">
                <div class="weui_cell_hd">
                    <label for="" class="weui_label">起始日期</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" id="on" type="date" name="ks" value="<?php echo I('get.ks')?I('get.ks'):$kstime; ?>"/>
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd">
                    <label for="" class="weui_label">结束日期</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" id="off" type="date" name="js" value="<?php echo I('get.js')?I('get.js'):$jstime; ?>"/>
                </div>
            </div>
        </div>
    </div>
    <div style="text-align:center" class="button-sp-area" >
        <input type="submit" style="width:99%;font-size:18px;color:#04BE02;background:white;border:1px solid #04BE02" class="weui-btn weui-btn_mini weui-btn_primary" value="按日期查询">
    </div>
</form>
<!------------------------时间搜索结束---------------------------->
    <script>
        $(function(){
            $('#riqi').click(function () {
                load(1);
                return false;
            })
        })
        function load(p) {
            var kstime = $('#on').val();
            var jstime = $('#off').val();
            var requester = $('#re').val();
            var openid = $('input[name=openid]').val();
            if (jstime < kstime) {
                alert('结束时间不能小于开始时间');
            } else {
                    var url = '__CONTROLLER__/ajaxconntime';
                    var data =  {kstime: kstime, jstime: jstime, requester: requester,p:p};
                    $.get(url,data, function(res) {
                        console.log(res);
                        var list = res.list;
                        var page_str = res.page_str;
                        var firstRow = res.firstRow;
                        var data_html = '<tr><th>序号</th><th>DPA报告号</th><th>接收人</th><th>接收时间</th><th>发放人</th></tr>';
                        if (list == null) {
                            data_html = '<div style="color:red;">没有检索到匹配记录!</div>';
                        } else {
                            for (var i = 0; i < list.length; i++) {
                                var id = i+1+firstRow;
                                data_html += "<tr id='tr2' class='tr2'><td>" + id + "</td><td><a href='__CONTROLLER__/seach_wc/dpasum/"+list[i].dpasum+"'>" + list[i].dpasum + "</a></td><td>" + list[i].getname + "</td><td>" + list[i].gettime + "</td><td>" + list[i].givename + "</td></tr>";
                            }
                        }
                        //追加分页代码
                        $('table').html(data_html);
                        $('.green-black').html(page_str);
                        //监听分页a标签
                        $('.green-black a').click(function(){
                            var href = this.href;
                            var request = /p\/(\d+)\.html$/;
                            var page = href.match(request)[1];
                            load(page);
                            return false;
                        });
                        background();
                     })
            }
        }
    </script>
    <table border="1">
        <tr id="tr1">
            <th>序号</th>
            <th>证书编号</th>
            <th>接收人</th>
            <th>接收时间</th>
            <th>发放人</th>
        </tr>
        <foreach name="list" item="v" key="key">
        <tr id="tr2" class="tr2">
            <td>{$key+1+$firstRow}</td>
            <td><a href="{:U('seach_wc',array('dpasum'=>$v[dpasum]))}">{$v.dpasum}</a></td>
            <td>{$v.getname}</td>
            <td>{$v.gettime|date='Y-m-d',###}</td>
            <td>{$v.givename}</td>
        </tr>
        </foreach>
    </table>
    <div style="margin-top:20px;font-size:14px;" class="green-black">{$page}</div>
    <input type="hidden" name="openid" value="{$openid}">
    <div style="width:100%;height:50px;border:1px solid white;"></div>
    <div class="fix-bottom">
            <button id="verify" onclick="abc()" class="weui_btn weui_btn_primary fix-bottom" >返回</button>
    </div>
</body>
<script>
    function abc(){
        WeixinJSBridge.call('closeWindow');
    }
    $(function(){
        background();
    });
    function background(){
        $('.tr2:odd').css('background','#F0F0F0');
    }
</script>
</html>